package com.ts.api.common.context;

import com.ts.api.common.entity.ApiParameter;
import com.ts.api.module.api.entity.po.ApiLogPO;
import com.ts.api.module.api.entity.vo.ReqApiParameterVO;
import org.springframework.core.NamedThreadLocal;

/**
 *  API上下文
 */
public class ApiContext {

    /**  API请求id */
    public static final ThreadLocal<String> REQ_ID = new NamedThreadLocal<>("Api Req Id");
    public static final ThreadLocal<ApiLogPO> LOG_OBJECT = new NamedThreadLocal<>("Api Log");
    public static final ThreadLocal<Long> TIME_TIME = new NamedThreadLocal<>("Api Cost Time");
    public static final ThreadLocal<String> CLIENT_ID = new NamedThreadLocal<>("Api client id");
    /** 业务编码 */
    public static final ThreadLocal<String> SERVICE_CODE = new NamedThreadLocal<>("Api Service code");

    /** 请求参数 */
    public static final ThreadLocal<ReqApiParameterVO> REQ_PARAMS = new NamedThreadLocal<>("Api Request Params");
    /** 解密参数 */
    public static final ThreadLocal<String> DECRYPT_DATA = new NamedThreadLocal<>("Api Decrypt Data");

    /** API拓展参数字段 */
    public static final ThreadLocal<ApiParameter> PARAMETER = new NamedThreadLocal<>("Api parameter");
}
